package com.gxa.service.investment.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gxa.dto.investmentDto.BusinessTypeDto;
import com.gxa.entity.commnotice.Notice;
import com.gxa.entity.investment.PlanAuthorization;
import com.gxa.mapper.investment.PlanAuthorizationMapper;
import com.gxa.service.investment.PlanAuthorizationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 招商配置——项目授权 服务实现类
 * </p>
 *
 * @author yjl
 * @since 2022-10-17 09:11:43
 */
@Service
public class PlanAuthorizationServiceImpl extends ServiceImpl<PlanAuthorizationMapper, PlanAuthorization> implements PlanAuthorizationService {

    @Autowired
    private PlanAuthorizationMapper planAuthorizationMapper;
    @Override
    public int add(PlanAuthorization planAuthorization) {
        return planAuthorizationMapper.insert(planAuthorization);
    }

    @Override
    public int delete(Integer id) {
        return planAuthorizationMapper.deleteById(id);
    }

    @Override
    public PlanAuthorization queryById(Integer id) {
        return planAuthorizationMapper.selectById(id);
    }

    @Override
    public int update(PlanAuthorization planAuthorization) {
        return planAuthorizationMapper.updateById(planAuthorization);
    }

    @Override
    public Map<String, Object> queryByAuthorizationPut(String authorizationPut, Integer pageNum, Integer pageSize) {
        Map<String,Object> map = new HashedMap();
        Page<PlanAuthorization> page = PageHelper.startPage(pageNum,pageSize);
        List<PlanAuthorization> planAuthorizationList = this.planAuthorizationMapper.queryByAuthorizationPut(authorizationPut);
        PageInfo<PlanAuthorization> pageInfo = new PageInfo<>(planAuthorizationList);
        map.put("pageInfo",pageInfo);
        return map;
    }
}
